<?php 

class Index_MoreAction extends C_Action  
{
		private $user_E = null;
		private $site_E = null;
		private $current_room_E = null;
		private $is_login = 0;
		private $RootOper = 0;
		public function init()
		{
			$this->user_E = Zend_Registry::get("user_E");
			$this->site_E = Zend_Registry::get("site_E");
			$this->current_room_E = Zend_Registry::get("current_room_E");
			$this->RootOper = Zend_Registry::get('RootOper');
			
			$this->is_login = Zend_Registry::get('is_login');
			$this->_response->is_login = $this->is_login;
			$module = $this->_request->getModule();
			
			$action = $this->_request->getAction();
			$method =  $this->_request->getMethod();
			$mvc = $module."_".$action."_".$method;
			$this->_response->mvc = $mvc;
		}
		public function doHeader()
		{
			
			//房间列表
			$room_ES = Rooms::getListBySiteId($this->site_E->id);
			$this->_response->room_ES = $room_ES;
			
			//组件
			$widget_ES = Widgets::getList();
			$this->_response->widget_ES = $widget_ES;

			//获取自身小站地址
			$self_site_E = Sites::getByUserid($this->user_E->id);
			$this->_response->self_site_E = $self_site_E;
			
			
			if($this->RootOper)
			{
				if($this->site_E->sign == 1)
				{
					$this->_response->isSiteFirstEnter = 1;
					$this->site_E->sign = 0;
				}
				$mod_num =  Mods::getNum($this->current_room_E->id);
				if($mod_num <= 0)
				{
					$this->_response->isRoomEmpty = 1;
				}
			}
			//用户信息
			
			//style css
			$style = $this->site_E->style;
			if(!empty($style))
			{
				$style = unserialize($style);
				$theme_id = $style['theme_id'];
				
				$bg_pic = $style['background_pic'];
				$bg = $style['background_color'];
				$pos = $style['background_pos'];
				$repeat = $style['background_repeat'];
				$nav = $style['banner_color'];
				$item = $style['tab_color'];
				$link = $style['link_color'];
				$color = $style['tab_link_color'];
				$bgfixed = $style['bgfixed'];
				$sp_nav_transparent = $style['sp_nav_transparent'];
				$themelogo = $style['themelogo'];
				if($themelogo)
				{
					$style_theme .= ".sp-logo a:link, .sp-logo a:visited, .sp-logo a:active, .sp-logo a:hover {color:$themelogo}";
					$init_theme .= "#theme-logo {background-color: $themelogo }";
				}
				else 
				{
					$init_theme .= "#theme-logo {background-color: #000 }";
				}
				if($bgfixed)
				{
					$style_theme .= " .bg {display:none;}        
					body { background-image: url($bg_pic) }
					
					body {
					    background-repeat: repeat;
					}
					body {
					    background-position: left top;
					}
					body {
					    background-attachment: fixed;
					}";
				}
				if(!empty($bg_pic))
				{
			 		$style_theme .= "
			 		.bg { background-image: url( $bg_pic ) }";
			 		
			 	}
				
				if(!empty($bg))
				{
			 		$style_theme .= "
			 		.bg { background-color: $bg }";
			 		$init_theme .= "
			 		#theme-bg {background-color: $bg }";
			 		
			 	}
				if(!empty($pos))
				{
			 		$style_theme .= "
				 	.bg { background-position: $pos top }";
			 	}
				if(!empty($repeat))
				{
			 		$style_theme .= "
				 	.bg { background-repeat: $repeat }";
			 	}
			 	if(!empty($nav))
			 	{
			 		$style_theme .= "
			 		.sp-nav { background-color: $nav }";
			 		$init_theme .= "
			 		#theme-banner {background-color: $nav }";
			 	}
				if($sp_nav_transparent)
				{
					$style_theme .= ".sp-nav { background-color: transparent }";
				}
				if(!empty($item))
			 	{
			 		$style_theme .= " 
			 		.nav-items li { background-color: $item }
      				.nav-items li.on { border-color: $item }
       				.nav-items li#room-more ul { border-color:$item; }";
       				
       				$init_theme .= " 
			 		 #theme-tag-bg {background-color:$item; }";
			 	}
				if(!empty($color))
			 	{
			 		$style_theme .= "    
			 			.nav-items li a:link,
       				    .nav-items li a:visited { color: $color }";
       				    
       				$init_theme .= "    
			 			#theme-tag-link {background-color: $color }";
			 	}
				if(!empty($link))
			 	{
			 		$style_theme .= " 
			 		.top-nav a:link, .top-nav a:visited, .top-nav a:hover, .top-nav a:active, .mod a, #footer a, .content-nav a { color: $link}
        			.top-nav .top-nav-info a:hover, .mod a:hover, #footer a:hover, .content-nav a:hover { color: $color; background-color: $link }";
        			$init_theme .= " #theme-link {background-color: $link }";
			 	}
				
			}
			if(empty($theme_id))
			{
				$theme_id = 1;
			}
			$this->_response->style_theme = $style_theme;
			$this->_response->init_theme = $init_theme;
			$this->_response->theme_id = $theme_id;
	
		}
		public function doFooter()
		{
			
		}
		
}
?>